//顶部面板
var north = new Ext.Panel({
    frame: true,
    plain: true,
    height: 85,
    region: 'north',
    items: [{
        baseCls: 'x-plain',
        border: false,
        height: 50,
        html: "<img src='Image/logo.jpg' style='height:50'></img>"
    },{
    	xtype:'toolbar',
    	items:[{
    		height: 20,
    		xtype:'label',
    		id:'uesrName',
    		width:200,
    		html:"<img src='Image/fam/user_gray.png' width='15px' id='userGra'>欢迎你，<span id='username'></span>同学",
    		listeners:{
    			 'render': function() {
    				 var a=Ext.get('username');
     		         a.on('click',function(){
     		        	//Ext.get('ssss').scale(500,300);
     		        });
     		      }
    		}
    	},'-',{  		
   		 xtype: 'combobox',
         itemId: 'mycombobox1',
         fieldLabel: '皮肤更换 ',
         iconCls:'Palette',
         labelAlign: 'right',
         labelPad: 1,
         labelWidth: 65,
         name: 'theme',
         value: 'ext-all.css',
         displayField : 'theme',  
         valueField : 'id', 
         forceSelection: true,
         queryMode: 'local',
         store:themestore,
         typeAhead: true,
         listeners: {
             change: { //改变选择时触发事件
                 fn: this.onMycomboboxChange11,
                 scope: this
             },
             afterrender: {//初始化数据
                 //fn: this.onMycomboboxAfterRender11,
                 scope: this
             }
         }
	},'->',{
    		xtype:'button',
    		id:'prompt',
    		width:150,
    		iconCls:'Bell',
    		//text:'暂无消息',
    		html:'<div id="d1"><marquee id="d2">暂无消息</marquee></div>',
    		handler:function(){
    			var ht = document.getElementById("d2").innerHTML;
    			if(ht != "暂无消息"){
    			/*var node=TreeStore.getNodeById("4");
    			node.expand();*/
    			//var node1=TreeStore.getNodeById("10");
    			//centersetActiveTab(rec);
    			var tab = center.queryById("150");
    			if(tab){
    				center.setActiveTab(tab);
    			}
    			else{
    			center.add({
    		        id: "150",
    		        iconCls: "",       
    		        xtype: "panel",
    		        title: "在线答疑", 
    		        closable: true,
    		        maskDiabled: true,
    		        frame: true,
    		        baseCls:'allBackImage',
    		        autoScroll : true,
    		        items: new studentMessage
    		    });
    		    center.setActiveTab("150");
    			}
    		    Ext.Ajax.request( {
    				url : "showNewMessageStrAction.action?flag=true",	
    				success : function(response, option) {
    					var obj = Ext.decode(response.responseText);
    				//	Ext.getCmp("messageList_panel").body.update(obj.msg);
    				/*	var store = Ext.getCmp("messageWest").getStore().findRecord("studentId",obj.studentId);
    					var model=Ext.getCmp("messageWest").getSelectionModel();
    					model.deselectAll();
    					model.select(store);*/
    					var d = Ext.getCmp('messageList_panel').body.dom;
    					d.scrollTop = d.scrollHeight - d.offsetHeight;
    					document.getElementById("d2").innerHTML = "暂无消息";
    				},
    				failure : function(response, option) {
    					
    				}
    				});  			
    			}
    		}
    	},{
    		 xtype: 'label',
    		    width: 250,
    		    id: 'clock',
    		    //cls:'Bell',
    		    listeners: {
    		      'render': function() {
    		        clockGo();
    		      }
    		    }
    	},{
    		xtype:'button',  
            text:'打开主页',  
            border:1,
            iconCls: 'index',
            handler: function(){  
            	center.setActiveTab(0);  
            }
    	},'-',{
    		xtype:'button',  
            text:'注销',  
            width:60,
            iconCls: 'grid-add',
            handler: function(){  
            	Ext.Msg.confirm('提示', '确定退出吗？', function (btn) {
                    if (btn == 'yes') {
                        window.location.href = "logoutAction.action";
                    }
                });
            } 
    	}]
    }]
});
//设置用户
function setusername() {
    document.getElementById("username").innerHTML = name;
}

var aWeek=['星期天','星期一','星期二','星期三','星期四','星期五','星期六'];
//显示时间
function clockGo() {
	  Ext.TaskManager.start({
	    run: function() {
	      Ext.getCmp("clock").setText(Ext.Date.format(new Date(), 'Y-N-d H:i:s A')+'  '+aWeek[new Date().getDay()]);
	    },
	    interval: 1000
	  });
	};
	